from api import app
from flask_cors import CORS
from interface import Interface
from rpyc.utils.server import ThreadedServer
import threading
import setting

def start_rpc():
    sr = ThreadedServer(Interface, port=setting.RPYC_LISTEN_PORT, auto_register=False, protocol_config={'allow_public_attrs': True})
    sr.start()


if __name__ == '__main__':
    CORS(app)
    threading.Thread(target=start_rpc).start()
    app.run(host='0.0.0.0', port=8008)
    